package com.ryzx.auth.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ryzx.jpa.helper.base.BapBaseEntity;
import com.ryzx.jpa.helper.comment.Comment;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;

import java.util.HashSet;
import java.util.Set;

@Getter
@Setter
@Entity
@Inheritance(strategy= InheritanceType.JOINED)
@Comment("用户表")
@Table(name = "bap_user")
public class BapUser extends BapBaseEntity {
    @Comment("姓名")
    @Column(nullable = false, length = 8)
    private String name;
    @Comment("账号")
    @Column(nullable = false,unique = true,length = 30)
    private String account;
    @JsonIgnore
    @Comment("密码")
    @Column(nullable = false,length = 80)
    private String ps;
    @Comment("移动电话")
    @Column(length = 20)
    private String tel;
    @Comment("头像")
    @Column(length = 30)
    private String avatar;

    @Comment("微信ID")
    @Column(nullable = true,length = 50)
    private String wechatId;

    @Comment("启用状态")
    @Column(nullable = false)
    private Boolean status = true;

    @JsonIgnore
    @Comment("所属岗位")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="post_id")
    private BapPost bapPost;

    @JsonIgnore
    @ManyToMany(fetch = FetchType.LAZY)
    //兼职岗位
    private Set<BapPost> otherPost = new HashSet<>();
}
